home *** CD-ROM | disk | FTP | other *** search
/ Tech Arsenal 1 / Tech Arsenal (Arsenal Computer).ISO / tek-02 / wgt_tp1.zip / WGT02.PAS < prev    next >
Pascal/Delphi Source File  |  1992-07-05  |  2KB  |  79 lines

  1. {**************************************************************************
  2.                           WordUp Graphics Toolkit
  3.                                  Demo File
  4.  
  5.  This program will open graphics mode 320*200 with 256 colors and draw some
  6.  lines on the screen using the WGT line command and the BGI LINE.
  7.  
  8.  Notice the difference in speeds, particularly with the horizontal lines.
  9.  **************************************************************************}
  10.  
  11. USES Graph,WGT;
  12.  
  13. VAR
  14.    grDriver, grMode : INTEGER;
  15.    x, y, ctr : INTEGER;
  16.    p : PALETTE;     { This is a type specific to WGT }
  17.  
  18. BEGIN
  19.      { Initialize graphics (see demo file #1) }
  20.      grDriver := INSTALLUSERDRIVER('VGA256',NIL);
  21.      grMode := 0;
  22.      INITGRAPH(grDriver,grMode,'c:\tp\bgi');
  23.  
  24.      { First load the demo palette file }
  25.      Load_Palette('demo.pal',p);
  26.  
  27.      { Use WGT's SETCOLOR to change the current drawing color,
  28.        it also controls Borland's graphics functions}
  29.  
  30.  
  31.      FOR ctr := 1 to 10 DO BEGIN     {Repeat 10 times}
  32.          _SETCOLOR(RANDOM(256));     {Using different colors}
  33.  
  34.          FOR x := 0 TO 319 DO BEGIN
  35.          _Line(x,0,x,199);       { Use WGT to draw 320 vertical lines }
  36.          END;
  37.  
  38.      END;
  39.  
  40.  
  41.      FOR ctr := 1 to 10 DO BEGIN
  42.          _SETCOLOR(RANDOM(256));
  43.          FOR X := 0 TO 319 DO BEGIN
  44.          LINE(x,0,x,199);        { Use BGI to draw 320 vertical lines }
  45.          END;
  46.      END;
  47.  
  48.      SETCOLOR(30);
  49.      OUTTEXT('Press Return');
  50.      READLN;                     { Wait for user to hit return }
  51.  
  52.      _ClearDevice(0);            { Clear the screen using color #0 }
  53.  
  54.      FOR ctr := 1 to 10 DO BEGIN
  55.          _SETCOLOR(RANDOM(256));
  56.          FOR y := 0 TO 199 DO BEGIN
  57.          _Line(0,y,319,y);       { Use WGT to draw 200 horizontal lines }
  58.          END;
  59.      END;
  60.  
  61.  
  62.      FOR ctr := 1 to 10 DO BEGIN          {Repeat 10 times}
  63.          _SETCOLOR(RANDOM(256));          {Using different colors}
  64.  
  65.          FOR y := 0 TO 199 DO BEGIN
  66.          LINE(0,y,319,y);        { Use BGI to draw 200 horizontal lines }
  67.          END;
  68.  
  69.      END;
  70.  
  71.  
  72.      _SETCOLOR(30);
  73.      OUTTEXT('Press Return');
  74.      READLN;
  75.  
  76.      { Now close the graphics system }
  77.  
  78.      CLOSEGRAPH;
  79. END.